package com.shuai.blog.service;

import com.shuai.blog.entity.UserInfo;
import com.shuai.blog.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public int register(UserInfo userInfo) {
        return userMapper.register(userInfo);
    }

    public UserInfo login(String username) {
        return userMapper.login(username);
    }

    public UserInfo getUserById(Integer userId) {
        return userMapper.getUserById(userId);
    }

    public int updateStateByName(UserInfo userInfo) {
        return userMapper.updateStateByName(userInfo);
    }

    public int getUserState(Integer userId) {
        return userMapper.getUserState(userId);
    }

    public int updateNickName(UserInfo userInfo) {
        return userMapper.updateNickName(userInfo);
    }

    public int updatePassword(UserInfo userInfo) {
        return userMapper.updatePassword(userInfo);
    }

    public int updatePhoto(Integer userId, String src) {
        return userMapper.updatePhoto(userId, src);
    }

    public UserInfo getConfidentialityAndAnswer(String username) {
        return userMapper.getConfidentialityAndAnswer(username);
    }

    public int updatePwdByAnswer(UserInfo userInfo) {
        return userMapper.updatePwdByAnswer(userInfo);
    }

}
